package com.sinosoft.perfect.system._resource.dao;

import java.sql.SQLException;
import java.util.List;

import com.sinosoft.perfect.common.system.BaseSqlSessionDaoSupport;
import com.sinosoft.perfect.system._.po.TResourceSystem;
import com.sinosoft.perfect.system._.po.TResourceSystemImg;
import com.sinosoft.perfect.system._resource.MapperSystemResource;

public class ResourceDAOImpl extends BaseSqlSessionDaoSupport implements IResourceDAO {
	
	private MapperSystemResource getMapperSystemResource(){
		return getSqlSession().getMapper(MapperSystemResource.class);
	}
	
	public Object selectTResourceMAXSortNum(TResourceSystem tresourcesystem) throws SQLException{
		return getMapperSystemResource().selectTResourceMAXSortNum(tresourcesystem);
	}
	
	public Object insertTResource(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().insertTResource(tresourcesystem);
	}
	
	public List<TResourceSystem> selectTResource(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().selectTResource(tresourcesystem);
	}
	
	public List<TResourceSystem> selectTResourceAndChildren(String resourceId) throws SQLException {
		return getMapperSystemResource().selectTResourceAndChildren(resourceId);
	}
	
	public Object selectTResourceSortNum(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().selectTResourceSortNum(tresourcesystem);
	}
	
	public Object selectTResourceSortNumMin(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().selectTResourceSortNumMin(tresourcesystem);
	}
	
	public Object selectTResourceByName(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().selectTResourceByName(tresourcesystem);
	}
	
	public Object selectTResourceSortNumByName(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().selectTResourceSortNumByName(tresourcesystem);
	}
	
	public int updateTResourceByPK(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().updateTResourceNotNullByPK(tresourcesystem);
	}
	
	public void updateTResourceAndChildrenStatus(TResourceSystem tresourcesystem) throws SQLException{
		getMapperSystemResource().updateTResourceAndChildrenStatus(tresourcesystem);
	}
	
	public List<TResourceSystem> selectTResourceAndChildren(TResourceSystem tresourcesystem) throws SQLException {
		return getMapperSystemResource().selectTResourceAndChildren(tresourcesystem.getResourceId());
	}
	
	public int deleteTRoleResourcesByResourceId(String resourceId) throws SQLException{
		return getMapperSystemResource().deleteTRoleResourcesByResourceId(resourceId);
	}
	
	public int deleteTResourcesByResourceId(String resourceId) throws SQLException{
		return getMapperSystemResource().deleteTResourcesByResourceId(resourceId);
	}

	@Override
	public List<TResourceSystem> selectTResourceAndParents(String resourceId)
			throws SQLException {
		return getMapperSystemResource().selectTResourceAndParents(resourceId);
	}

	@Override
	public Object insertTResourceImg(TResourceSystemImg tresourceSystemImg)
			throws SQLException {
		return getMapperSystemResource().insertTResourceImg(tresourceSystemImg);
	}

	@Override
	public int updateTResourceImg(TResourceSystemImg tresourceSystemImg)
			throws SQLException {
		return getMapperSystemResource().updateTResourceImg(tresourceSystemImg);
	}

	@Override
	public int deleteTResourceImg(TResourceSystemImg tresourceSystemImg)
			throws SQLException {
		return getMapperSystemResource().updateTResourceImg(tresourceSystemImg);
	}

	@Override
	public List<TResourceSystemImg> selectTResourceImg(
			TResourceSystemImg tresourceSystemImg) throws SQLException {
		return getMapperSystemResource().selectTResourceImg(tresourceSystemImg);
	}
	
}
